//this shader draw a rectangle with a color and uv coordinates
//require primitive is triangle strip
//use 4 vertices

#version 460
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable



layout (location = 0) out vec4 outColor;
layout (location = 1) out vec2 outUV;
layout (location = 2) out float outInnerRadius;

layout (push_constant) uniform SRectVectexPushConstants
{
   vec4 Color;
   float Z; //z order of widget
   float InnerRadius;
   float Padding[2];
} RectPushConstants;

const vec2 Vertices[4] = vec2[4](
   vec2(-1.0f, -1.0f),
   vec2(1.0f, -1.0f),
   vec2(-1.0f, 1.0f),
   vec2(1.0f, 1.0f)
);

const vec2 UVs[4] = vec2[4](
   vec2(0.0f, 0.0f),
   vec2(1.0f, 0.0f),
   vec2(0.0f, 1.0f),
   vec2(1.0f, 1.0f)
);

void main() 
{
   gl_Position = vec4(Vertices[gl_VertexIndex], RectPushConstants.Z, 1.0f);
   outColor = RectPushConstants.Color;
   outUV = UVs[gl_VertexIndex];
   outInnerRadius = RectPushConstants.InnerRadius;
}